package com.maibow.base.defines;

import javax.servlet.http.HttpServlet;

import com.maibow.util.Logger;

/**
 * 
 * @author Roy
 *
 */
@SuppressWarnings("serial")
public class InitServlet extends HttpServlet {
	private Logger log = Logger.getLogger(InitServlet.class);
	
	public void init() {
		try{
			initConfigInfo();
		} catch(Exception ex) {
			log.error("初始化系统配置信息出错:"+ex);
		}
		
		/**
		 * 打印内存信息
		 */
		int max = (int ) java.lang.Runtime.getRuntime().maxMemory() / (1024 * 1024);
		log.info("容器申请最大内存总量:"+max+"M.");
		
	}

	/**
	 * 初始化web的配置信息
	 */
	private void initConfigInfo() {
		((IParameterReadService)BeanGenerator.getBean("parameterReadService")).initSConfigure();
	}
	
	/*
	 * (non-Javadoc)
	 * @see javax.servlet.GenericServlet#destroy()
	 */
	public void destroy() {
		System.out.println("Destroy a servlet");
	}
}
